Repository navigation
fix(id/web): assert plugin non-null in image-upload paste helper (#3249) - #5013
Conversation
The #1323 batch-ordering describe narrows `plugin` with an early throw, but TypeScript does not carry the narrowing into the nested `paste()` helper declaration, so `handlePaste!.call(plugin, ...)` passed `Plugin | null` where ProseMirror's handler types its thisArg as `Plugin`. `tsc --noEmit` was red on main with this single TS2345 and nothing else. Use the file's existing convention (the surrounding helpers already write `plugin!` when passing it into `plugins`) at the call site. No behaviour change: the describe body has already thrown if plugin is null, and the suite's 47 tests are unchanged and pass.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 52 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
What
pkgs/id/webtsc --noEmitis red onmainwith exactly one error:The
#1323batch-ordering describe narrowspluginwithif (!plugin) throw, but TypeScript does not carry that narrowing into the nestedpaste()helper declaration, sohandlePaste!.call(plugin, ...)still passesPlugin | nullwhere ProseMirror types the handler'sthisArgasPlugin.Fix:
plugin!at that one call site — the same convention this file already uses two lines above increateView()(plugins: [plugin!]). No behaviour change: the describe body has already thrown if the plugin is null.Closes #3249.
Verification
cd pkgs/id/web && ./node_modules/.bin/tsc --noEmit→ exit 0 (was exit 2 with the TS2345 above)cd pkgs/id/web && ./node_modules/.bin/vitest run src/image-upload.test.ts→ 47 passed (1 file)Queue task: 8459 (repo-health-code-pilot).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.